﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;

namespace Web.admin.NewsManage.Photos
{
    public partial class RoundList : System.Web.UI.Page
    {
        BLL.PhotoService photoservice = new BLL.PhotoService();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Rp_PhotoBind();
            }
        }

        /// <summary>
        /// repeater绑定事件
        /// </summary>
        protected void Rp_PhotoBind()
        {
            lbCount.InnerText = photoservice.GetIsRound().ToString();
            Rp_Photo.DataSource = photoservice.GetRoundPhoto();
            Rp_Photo.DataBind();
        }

        /// <summary>
        /// repeater事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rp_Event(object sender, RepeaterCommandEventArgs e)
        {
            string PhotoId = ((HiddenField)e.Item.FindControl("hf_Id")).Value;
            BoPhotos PhotoModel = photoservice.getPhoto(PhotoId);
            switch (e.CommandName)
            {
                case "CancelShow":
                    PhotoModel.PHO_IsRound = false;
                    break;
            }
            photoservice.ModifyPhoto(PhotoModel);
            Rp_PhotoBind();
        }
    }
}